package com.tangruojie;

import com.tangruojie.dao.BookDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AppForScope {

    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");

        /**
         * Bean的作用范围
         * 默认单例模式 singleton
         * 多例模式 prototype
         */
        BookDao bookDao1 = (BookDao) applicationContext.getBean("bookDao");
        System.out.println(bookDao1);

        BookDao bookDao2 = (BookDao) applicationContext.getBean("bookDao");
        System.out.println(bookDao2);

    }

}
